package com.xy.biz.uc.domain.converter;

import com.xy.biz.uc.domain.bo.TeamBO;
import com.xy.biz.uc.domain.po.TeamPO;
import com.xy.biz.uc.domain.query.TeamQuery;
import com.xy.biz.uc.domain.req.ListTeamRequest;
import com.xy.biz.uc.domain.req.SaveTeamRequest;
import com.xy.biz.uc.domain.resp.GetTeamResponse;
import com.xy.biz.uc.domain.resp.GetUserTeamResponse;
import com.xy.tool.util.BeanUtilsEx;

import java.util.Collection;
import java.util.List;

/**
 * @author Greekn Zhang
 * @date 2021/5/7 16:54
 */
public class UserTeamConverter {

	public static TeamPO toPO(TeamBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new TeamPO(), true);
	}

	public static List<TeamPO> toPO(Collection<TeamBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new TeamPO(), true);
	}

	public static TeamBO fromPO(TeamPO source) {
		return BeanUtilsEx.copyProperties(source, () -> new TeamBO());
	}

	public static List<TeamBO> fromPO(Collection<TeamPO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new TeamBO());
	}

	public static TeamBO toBO(SaveTeamRequest source) {
		return BeanUtilsEx.copyProperties(source, () -> new TeamBO(), true);
	}

	public static List<TeamBO> toBO(Collection<SaveTeamRequest> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new TeamBO(), true);
	}

	public static GetUserTeamResponse toResponse(TeamBO source) {
		return BeanUtilsEx.copyProperties(source, () -> new GetUserTeamResponse());
	}

	public static List<GetUserTeamResponse> toResponse(Collection<TeamBO> source) {
		return BeanUtilsEx.copyPropertiesForNewList(source, () -> new GetUserTeamResponse());
	}


}
